package com.cn766.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.cn766.test.PullToRefreshViewActivity;
import com.cn766.ui.lib.PullToRefreshView;
import com.example.slidingmenu.R;

public class LeftFragment extends Fragment {


	Context context;
	Button btnA;
	Button btnB;
	
	
	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
	}


	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		
		
		
	}
	

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.left, null);
		
		return view;
	}
	

	@Override
	public void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		btnA=(Button)getActivity().findViewById(R.id.btn_a);

		
		btnA.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				System.out.println("btnA is pressed");
				
				FragmentTransaction ft = getFragmentManager().beginTransaction();
				SampleListFragment indexFragment=new SampleListFragment();
				ft.replace(R.id.content_fragment, indexFragment);
				
				ft.commit();
				
				
			}
		});
		btnB=(Button)getActivity().findViewById(R.id.btn_b);
		btnB.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
			Intent i= new Intent(getActivity(),PullToRefreshViewActivity.class);
			startActivity(i);
			
				
			}
		});
		
	}


	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
	}
	

}
